package winapi

import (
	"github.com/CodyGuo/win"
)

//启动程序，cmd用全路径程序如"c:\\windows\\notepad.exe"
func (*Winapi) Run(cmd string) (err error) {
	var (
		//lpOperation  *byte
		//lpFile       *byte
		//lpParameters *byte
		//lpDirectory  *byte
		lpCmdLine *byte
	)
	/*
		    lpFile = win.StringToBytePtr("c:\\windows\\notepad.exe")
			lpOperation = win.StringToBytePtr("open")
			lpParameters = win.StringToBytePtr("")
			lpDirectory = win.StringToBytePtr("c:\\windows\\")
	*/
	lpCmdLine = win.StringToBytePtr(cmd) //"c:\\windows\\notepad.exe"
	//WinExec可以用
	win.WinExec(lpCmdLine, 5)
	//用win.ShellExecute执行后不能运行notepad.exe程序
	//win.ShellExecute(s.handle, s.lpOperation, s.lpFile, s.lpParameters, s.lpDirectory, 9)
	return err
}
